package com.sky.mapper;


import com.github.pagehelper.Page;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
    //新增
    @Insert("INSERT INTO category(type,name,sort,status,create_time,update_time,create_user,update_user)" +
            "VALUES(#{type},#{name},#{sort},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    public void insert(Category category);

    //分页
    Page<Category> pageCategory(CategoryPageQueryDTO categoryPageQueryDTO);

    //删除
    @Delete("delete from category where id = #{id} ")
    void deleteCategory(Long id);

    //修改
    void updateCategory(Category updateCategory);

    //修改状态
    void updateStatus(Category category);

    //根据分类id查询实体
    @Select("select  * from category where  id = #{id}")
    Category getById(Long id);


    //根据类型查询
    List<Category> selectType(Integer type);
}
